package org.estela;

import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.Properties;

public class Version {

	private static final Properties properties = new Properties();
	
	static {
		try {
			String propFile = System.getProperty("version");
			if (propFile != null) {
				FileInputStream fin = new FileInputStream(new File(propFile));
				properties.load(fin);
				fin.close();
			} else {
				InputStream in = Version.class.getResourceAsStream("version.properties");
				properties.load(in);
			}
		} catch (Exception ex) {
			throw new Error("No version.properties file found.", ex);
		}
	}
	
	//Estela version
	public static final String VERSION = "version";
	
	//GUI properties
	public static final String MENU_FILE = "frame.menu.file";
	public static final String MENU_RUN = "frame.menu.run";
	public static final String FRAME_TITLE = "frame.title";
	public static final String MENU_ITEM_NEW = "frame.menu.file.new";
	public static final String MENU_ITEM_OPEN = "frame.menu.file.open";
	public static final String MENU_ITEM_SAVE = "frame.menu.file.save";
	public static final String MENU_ITEM_SAVE_AS = "frame.menu.file.saveAs";
	
	public static final String MENU_ITEM_EXIT = "frame.menu.file.exit";
	public static final String MENU_ITEM_RUN = "frame.menu.run.run";
	public static final String MENU_ITEM_SHOW_AST = "frame.menu.run.showAST";
	public static final String MENU_HELP = "frame.menu.help";
	public static final String MENU_ITEM_ABOUT = "frame.menu.help.about";

	public static final String MENU_EDIT = "frame.menu.edit";
	public static final String MENU_ITEM_CLEAR = "frame.menu.edit.clear";


	public static String getProperty(String key) {
		return properties.getProperty(key);
	}
}
